{% extends 'form_div_layout.html.twig' %}
{% block form_widget_simple %}
        {% set type = type|default('text') -%}
        <div class="{% if attr.divClass is defined %}{{ attr.divClass }}{% else %}col-sm-9{% endif %}">
            <input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
            {{- block('help_block') -}}
        </div>
{% endblock %}

{% block textarea_widget -%}
    {% set type = type|default('text') -%}
        <div class="col-sm-9">
            <textarea {{ block('widget_attributes') }} >{{ value }}</textarea>
        </div>
{%- endblock textarea_widget %}

{% block form_label -%}
    {% if label is not sameas(false) -%}
        {% if not compound -%}
            {% set label_attr = label_attr|merge({'for': id}) %}
        {%- endif %}

        {% set label_attr = label_attr|merge({'class': (label_attr.class|default('col-sm-3 control-label no-padding-right'))|trim}) %}

        {% if label is empty -%}
            {% set label = name|humanize %}
        {%- endif -%}
        <label {% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}  >{{ label|trans({}, translation_domain) }} {% if required %}<font color="red">*</font>{% endif %} </label>
    {%- endif %}
{%- endblock form_label %}


{% block form_row -%}
    <div class="form-group{% if errors|length > 0  %} has-error{% endif %}">
        {{- form_label(form) -}}
        {{- form_widget(form) -}}
        {{- form_errors(form) -}}
    </div>
{%- endblock form_row %}

{% block form_start -%}
    {% set method = method|upper %}
    {%- if method in ["GET", "POST"] -%}
        {% set form_method = method %}
    {%- else -%}
        {% set form_method = "POST" %}
    {%- endif -%}
    <form name="{{ form.vars.name }}" method="{{ form_method|lower }}" action="{{ action }}"{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}{% if multipart %} enctype="multipart/form-data"{% endif %} class="form-horizontal" >
    {%- if form_method != method -%}
        <input type="hidden" name="_method" value="{{ method }}" />
    {%- endif -%}
{%- endblock form_start %}

{% block button_row -%}
    <div class="col-md-offset-3 col-md-9">
        {{- form_widget(form) -}}
    </div>
{%- endblock button_row %}

{% block choice_widget -%}
<div class="{% if attr.divClass is defined %}{{ attr.divClass }}{% else %}col-sm-9{% endif %}">
    {% if expanded %}
        {{- block('choice_widget_expanded') -}}
    {% else %}
        {{- block('choice_widget_collapsed') -}}
    {% endif %}
</div>
{%- endblock choice_widget %}

{% block choice_widget_expanded -%}
        <div class="{% if attr.class is defined %}{{ attr.class }}{% else %}col-xs-10 col-sm-4{% endif %}">
        {%- for child in form %}
            <label class="{% if form.vars.multiple %}checkbox{% else %}radio{% endif %}-inline " {{ block('widget_container_attributes') }}  >
            {{- form_widget(child) -}}
            {{ child.vars.label | trans }}
            </label>
        {% endfor -%}
        </div>
    {{- block('help_block') -}}

{% endblock choice_widget_expanded %}

{% block form_errors -%}
    {% if errors|length > 0 -%}
            {%- for error in errors -%}
                <div class="help-block col-xs-12 col-sm-reset inline">{{ error.message }}</div>
            {%- endfor -%}
    {%- endif %}
{%- endblock form_errors %}

{% block choice_widget_collapsed %}
    {{ parent() }}
    {{- block('help_block') -}}
{% endblock %}



{% block radio_widget -%}
    {{ parent() }}
    {{- block('help_block') -}}
{% endblock %}

{% block help_block %}
    {% if help is defined %}
        <span class="help-button col-xs-3 col-sm-1" data-rel="popover" data-trigger="hover" data-placement="bottom" data-content="{{ help|trans }}" title="">?</span>
    {% endif %}
{% endblock %}